//
//  ZYSuperManagementSystemController.m
//  HHHHH
//
//  Created by Ethan on 2017/9/16.
//  Copyright © 2017年 乾坤. All rights reserved.
//

#import "ZYSuperManagementSystemController.h"
#import "ZYSuperManagementCell.h"
#define kCell @"cell"
@interface ZYSuperManagementSystemController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *dataSource;
@property (nonatomic,assign) BOOL isTrue;
@property (nonatomic,assign) NSInteger page;
    
@end

@implementation ZYSuperManagementSystemController

    
    
- (NSMutableArray *)dataSource {
    
    if (_dataSource == nil) {
        self.dataSource = [NSMutableArray array];
    }
    
    return _dataSource;
    
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIView *grvuew = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 15)];
    grvuew.backgroundColor = ColorRGB(247, 245, 245);
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH - 20 , SCREENH_HEIGHT - 64)];
    self.view.backgroundColor =ColorRGB(247, 245, 245);
    self.tableView.backgroundColor = ColorRGB(247, 245, 245);
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
   
    [self.view addSubview:self.tableView];
    
    self.tableView.tableHeaderView = grvuew;
    [self.tableView registerClass:[ZYSuperManagementCell  class] forCellReuseIdentifier:kCell];
  
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.showsVerticalScrollIndicator = NO;
    self.tableView.estimatedRowHeight = 200;
    
    
}


    
    
    
    
    
    
#pragma mark --- 上拉加载和下拉刷新方法的实现
- (void)setUpRefresh{
    
    //下拉刷新
    self.tableView.mj_header  = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(downRefresh)];
    //自动更改透明度
    self.tableView.mj_header.automaticallyChangeAlpha = YES;
    //进入刷新状态
    [self.tableView.mj_header beginRefreshing];
    
    //上拉加载
    self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(upRefresh)];
    //结束头部刷新
    [self.tableView.mj_header endRefreshing];
    //结束尾部刷新
    [self.tableView.mj_footer endRefreshing];
    
    
}
    
    /**
     *  上拉加载
     */
- (void)upRefresh{
    
    self.isTrue = NO;
    self.page++;
    [self setNetWork];
    
}
    /**
     *  下拉刷新
     */
    
- (void)downRefresh{
    self.isTrue = YES;
    self.page = 1;
    [self setNetWork];
    
    
}
    
    
    
#pragma mark --- 网络请求方法的实现
- (void)setNetWork{
    
    
    
    
    
    
}
    
    
    
    
    
    
    
    
    
    
    
    

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    
    return 10;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ZYSuperManagementCell *cell = [tableView dequeueReusableCellWithIdentifier:kCell forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    [cell.studentButton addTarget:self action:@selector(studentButtonAction:) forControlEvents:(UIControlEventTouchUpInside)];
    
    

    
    
    
    
    return cell;
}


#pragma mark --- 学生详情方法的实现
- (void)studentButtonAction:(UIButton *)sender{
        
        

    NSLog(@"ddd");
        
    
}
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
@end
